package com.example.service.impl;

import com.example.common.R;
import com.example.dao.CommentDao;
import com.example.dao.impl.CommentDaoImpl;
import com.example.pojo.entity.ApComment;
import com.example.pojo.req.CommentReq;
import com.example.service.CommentService;

public class CommentServiceImpl implements CommentService {

    CommentDao commentDao = new CommentDaoImpl();

    /**
     * 添加评论
     *
     * @param comment
     * @param token
     * @return
     * @throws Exception
     */
    @Override
    public R addComment(CommentReq comment, String token) throws Exception {
        return commentDao.addComment(comment, token);
    }

    /**
     * 获取评论列表
     *
     * @param newsId
     * @throws Exception
     */
    @Override
    public R getCommentTree(String newsId, String commentId) throws Exception {
        return commentDao.getCommentTree(newsId, commentId);
    }

    @Override
    public R getFirstComment(String newsId) throws Exception {
        return commentDao.getFirstComment(newsId);
    }
}
